import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LeaseVO, LeaseForm, LeaseQuery } from '@/api/zichanguanli/lease/types';

/**
 * 查询房产历史租赁列表
 * @param query
 * @returns {*}
 */

export const listLease = (query?: LeaseQuery): AxiosPromise<LeaseVO[]> => {
  return request({
    url: '/zichanguanli/lease/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询房产历史租赁详细
 * @param id
 */
export const getLease = (id: string | number): AxiosPromise<LeaseVO> => {
  return request({
    url: '/zichanguanli/lease/' + id,
    method: 'get'
  });
};

/**
 * 新增房产历史租赁
 * @param data
 */
export const addLease = (data: LeaseForm) => {
  return request({
    url: '/zichanguanli/lease',
    method: 'post',
    data: data
  });
};

/**
 * 修改房产历史租赁
 * @param data
 */
export const updateLease = (data: LeaseForm) => {
  return request({
    url: '/zichanguanli/lease',
    method: 'put',
    data: data
  });
};

/**
 * 删除房产历史租赁
 * @param id
 */
export const delLease = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/lease/' + id,
    method: 'delete'
  });
};
